<html>
<head><meta charset="utf-8"><title>eager THIR construction · project-thir-unsafeck · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/index.html">project-thir-unsafeck</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html">eager THIR construction</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227582697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582697">(Feb 24 2021 at 11:12)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@Léo Lanteri Thauvin</span> I'm making this topic to track notes on that -- you said you have a WIP prototype?</p>



<a name="227582781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582781">(Feb 24 2021 at 11:13)</a>:</h4>
<p>Well, I'm still doing the refractor</p>



<a name="227582815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582815">(Feb 24 2021 at 11:13)</a>:</h4>
<p>Currently I have to fix 145 errors :3</p>



<a name="227582824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582824">(Feb 24 2021 at 11:13)</a>:</h4>
<p>Fun =)</p>



<a name="227582825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582825">(Feb 24 2021 at 11:13)</a>:</h4>
<p>ok</p>



<a name="227582844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582844">(Feb 24 2021 at 11:13)</a>:</h4>
<p>we should probably add that to the project board I guess</p>



<a name="227582853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582853">(Feb 24 2021 at 11:14)</a>:</h4>
<p>I guess I sort of did</p>



<a name="227582858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582858">(Feb 24 2021 at 11:14)</a>:</h4>
<p>never mind</p>



<a name="227582889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582889">(Feb 24 2021 at 11:14)</a>:</h4>
<p>Oh while you're here</p>



<a name="227582902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582902">(Feb 24 2021 at 11:14)</a>:</h4>
<p>yep</p>



<a name="227582932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227582932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227582932">(Feb 24 2021 at 11:14)</a>:</h4>
<p>I don't know if I should be using <code>box</code> expressions</p>



<a name="227583052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583052">(Feb 24 2021 at 11:15)</a>:</h4>
<p>Basically, my <code>ExprKind</code> holds some <code>Box&lt;Expr&gt;</code></p>



<a name="227583182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583182">(Feb 24 2021 at 11:16)</a>:</h4>
<p>Which I think should be the expected form, so that it gets dropped as soon as it's not needed?</p>



<a name="227583258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583258">(Feb 24 2021 at 11:17)</a>:</h4>
<p>And so when I'm building the THIR</p>



<a name="227583276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583276">(Feb 24 2021 at 11:17)</a>:</h4>
<p>Should I <code>Box::new(expr)</code> or <code>box expr</code>?</p>



<a name="227583304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583304">(Feb 24 2021 at 11:17)</a>:</h4>
<p>I've never used <code>box x</code> expressions before <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>



<a name="227583419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583419">(Feb 24 2021 at 11:18)</a>:</h4>
<p>use either at your leasure in the compiler</p>



<a name="227583650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583650">(Feb 24 2021 at 11:20)</a>:</h4>
<p><span class="user-mention" data-user-id="255061">@Léo Lanteri Thauvin</span> interesting</p>



<a name="227583677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583677">(Feb 24 2021 at 11:20)</a>:</h4>
<p>I guess that makes sense</p>



<a name="227583698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583698">(Feb 24 2021 at 11:21)</a>:</h4>
<p>I hadn't really thought about how we never needed to even <em>box</em> THIR before</p>



<a name="227583711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583711">(Feb 24 2021 at 11:21)</a>:</h4>
<p>I am pondering if we should use a local arena :)</p>



<a name="227583714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583714">(Feb 24 2021 at 11:21)</a>:</h4>
<p>I kind of think yes</p>



<a name="227583728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583728">(Feb 24 2021 at 11:21)</a>:</h4>
<p>but that makes the refactor rather more invasive :)</p>



<a name="227583738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583738">(Feb 24 2021 at 11:21)</a>:</h4>
<p>(you would need <code>'thir</code> everywhere)</p>



<a name="227583943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227583943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227583943">(Feb 24 2021 at 11:23)</a>:</h4>
<p>If that sounds good to you, I will do a first pass with <code>Box</code>es</p>



<a name="227584118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227584118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227584118">(Feb 24 2021 at 11:25)</a>:</h4>
<p>I'm wondering if as a first test we could be "eager" by walking the THIR and lowering all <code>Thir</code> variants to <code>Mirror</code> variants and not actually change anything else</p>



<a name="227584184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227584184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227584184">(Feb 24 2021 at 11:25)</a>:</h4>
<p>once that is done, we can start removing mirror calls everywhere else (which can now be done in small steps instead of everywhere at once)</p>



<a name="227584272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227584272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227584272">(Feb 24 2021 at 11:26)</a>:</h4>
<p>and when that is done we can rewrite the THIR construction in small steps, too</p>



<a name="227584286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227584286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227584286">(Feb 24 2021 at 11:26)</a>:</h4>
<p>(hopefully avoiding the 145x errors-to-fix situation)</p>



<a name="227584536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227584536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227584536">(Feb 24 2021 at 11:29)</a>:</h4>
<p>I'm not sure I understand how that would work, <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="227584881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227584881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227584881">(Feb 24 2021 at 11:33)</a>:</h4>
<p>We have the current THIR datastructure that mostly uses <code>Thir</code> variants and only mirrors them on demand. So if we want to measure a worst case impact on max-rss, <del>we could grab the root expression that we use to go from THIR to MIR and before doing that conversion we walk said expression </del>.... ok wait, we can indeed just start doing a more eager THIR construction without causing any breakage. Basically we keep the current datastructure, but at every expression level we immediately start calling mirror.</p>



<a name="227585032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585032">(Feb 24 2021 at 11:34)</a>:</h4>
<p>If we don't touch the datastructures, we should get zero breakage, thus being able to start making THIR construction eager in small steps instead of having to do everything at once</p>



<a name="227585216"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585216" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585216">(Feb 24 2021 at 11:36)</a>:</h4>
<p>the problem is</p>



<a name="227585227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585227">(Feb 24 2021 at 11:36)</a>:</h4>
<p>we can't just call mirror unless we store them all in a vector or something?</p>



<a name="227585230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585230">(Feb 24 2021 at 11:36)</a>:</h4>
<p>we could do that</p>



<a name="227585236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585236">(Feb 24 2021 at 11:36)</a>:</h4>
<p>they have to be stored <em>somewhere</em></p>



<a name="227585261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585261">(Feb 24 2021 at 11:37)</a>:</h4>
<p>it would give us a measurement, for sure</p>



<a name="227585264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585264">(Feb 24 2021 at 11:37)</a>:</h4>
<p>a pessimistic one</p>



<a name="227585397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227585397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227585397">(Feb 24 2021 at 11:38)</a>:</h4>
<p>I read that on the docs of the <code>Mirror</code> trait, but I don't see how that actually happens in practice ("that" being "getting multiple THIR expressions from a single HIR expression")</p>



<a name="227586149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227586149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227586149">(Feb 24 2021 at 11:47)</a>:</h4>
<p>I'm already deep into the bruteforce refractor</p>



<a name="227586154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227586154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227586154">(Feb 24 2021 at 11:47)</a>:</h4>
<p>:)</p>



<a name="227586155"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227586155" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227586155">(Feb 24 2021 at 11:47)</a>:</h4>
<p>ok <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="227586170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227586170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227586170">(Feb 24 2021 at 11:47)</a>:</h4>
<p>It won't be pleasant to review though :D</p>



<a name="227643422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227643422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227643422">(Feb 24 2021 at 17:58)</a>:</h4>
<p>Alright, I got rustc to compile</p>



<a name="227643456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227643456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227643456">(Feb 24 2021 at 17:59)</a>:</h4>
<p>I have two failing tests (<code>ui/issues/issue-74564-if-expr-stack-overflow.rs</code> and <code>ui/nll/issue-54382-use-span-of-tail-of-block.rs</code>)</p>



<a name="227660807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227660807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227660807">(Feb 24 2021 at 19:53)</a>:</h4>
<p>Wrap your recursive function calls in the ensure sufficient stack function (on mobile, I forget the name)</p>



<a name="227660954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227660954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227660954">(Feb 24 2021 at 19:54)</a>:</h4>
<p>That should fix the failures, as they are likely due to stack overflow in deeply nested expressions</p>



<a name="227668131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227668131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227668131">(Feb 24 2021 at 20:38)</a>:</h4>
<p>Opened <a href="https://github.com/rust-lang/rust/issues/82495">#82495</a> for a first perf run</p>



<a name="227692823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227692823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227692823">(Feb 24 2021 at 23:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction/near/227660807">said</a>:</p>
<blockquote>
<p>Wrap your recursive function calls in the ensure sufficient stack function (on mobile, I forget the name)</p>
</blockquote>
<p>I had removed one of those <code>ensure_sufficient_stack</code> calls, so I thought just adding it back would be enough, turns out it isn't</p>



<a name="227693127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227693127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227693127">(Feb 24 2021 at 23:29)</a>:</h4>
<p>Oh, of course</p>



<a name="227693149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227693149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227693149">(Feb 24 2021 at 23:29)</a>:</h4>
<p>Because I don't hit it during THIR construction</p>



<a name="227735935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227735935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227735935">(Feb 25 2021 at 08:50)</a>:</h4>
<p>Welp, perf is... not good</p>



<a name="227741148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741148">(Feb 25 2021 at 09:42)</a>:</h4>
<p>I would guess this is related to the use of <code>Box</code> everywhere</p>



<a name="227741169"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741169" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741169">(Feb 25 2021 at 09:42)</a>:</h4>
<p>that reminds me</p>



<a name="227741242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741242">(Feb 25 2021 at 09:43)</a>:</h4>
<p><em>ah</em></p>



<a name="227741264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741264">(Feb 25 2021 at 09:43)</a>:</h4>
<p>I understand now what <span class="user-mention" data-user-id="124288">@oli</span> was saying about using <code>ExprRef::Mirror</code> everywhere</p>



<a name="227741280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741280">(Feb 25 2021 at 09:43)</a>:</h4>
<p>I forgot that <code>ExprRef</code> was an enum</p>



<a name="227741328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741328">(Feb 25 2021 at 09:43)</a>:</h4>
<p>ok, I definitely agree then that this would've been a more incremental path :)</p>



<a name="227741348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741348">(Feb 25 2021 at 09:43)</a>:</h4>
<p>so I think the question is --</p>



<a name="227741389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741389">(Feb 25 2021 at 09:44)</a>:</h4>
<p>is it worth trying to prototype a version based on arenas?</p>



<a name="227741418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227741418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227741418">(Feb 25 2021 at 09:44)</a>:</h4>
<p>that will require a lot of lifetime threading</p>



<a name="227757703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227757703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227757703">(Feb 25 2021 at 12:18)</a>:</h4>
<p>as an experiment it may suffice put an arena into a <code>static</code> and thus just use <code>'static</code> lifetimes on the arena references everywhere</p>



<a name="227757784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227757784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227757784">(Feb 25 2021 at 12:19)</a>:</h4>
<p>that will blow up max-rss, but we should see whether it has positive effects on instructions counts</p>



<a name="227757994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/227757994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#227757994">(Feb 25 2021 at 12:21)</a>:</h4>
<p>another idea could be to start out with doing this eager stuff just for patterns, since patterns are being built twice today</p>



<a name="228463372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228463372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228463372">(Mar 02 2021 at 18:45)</a>:</h4>
<p>I haven't had time to experiment more on this this week-end unfortunately. <span class="user-mention" data-user-id="124288">@oli</span> should there be a concern on the MCP so it doesn't get accepted immediately?</p>



<a name="228464119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228464119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228464119">(Mar 02 2021 at 18:49)</a>:</h4>
<p>i think <span class="user-mention" data-user-id="255061">@Léo Lanteri Thauvin</span> we should just drop a note on the MCP saying that we are experimenting to see about performance overhead</p>



<a name="228612661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228612661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228612661">(Mar 03 2021 at 15:38)</a>:</h4>
<p>I just pushed a commit refractoring <code>Builder</code> to not take <code>thir::Cx</code> (since it shouldn't produce THIR anymore).</p>



<a name="228612757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228612757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228612757">(Mar 03 2021 at 15:39)</a>:</h4>
<p>I don't think it will change perf, but I'm usually so off with predicting perf that maybe it would be worth it to have a perf run?</p>



<a name="228615341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228615341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228615341">(Mar 03 2021 at 15:53)</a>:</h4>
<p><code>&lt;rustc_mir_build::thir::Expr as core::clone::Clone&gt;::clone</code> is one of new things on the profile. Possibly something that was cheap when conversion was lazy, but is expensive now?</p>



<a name="228615960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228615960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228615960">(Mar 03 2021 at 15:56)</a>:</h4>
<p>Oh, there a way to get the profile?</p>



<a name="228616050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228616050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228616050">(Mar 03 2021 at 15:56)</a>:</h4>
<p>Ohhhh, by clicking on the different run numbers. That's helpful <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>



<a name="228616254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228616254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228616254">(Mar 03 2021 at 15:57)</a>:</h4>
<p>Thanks for the help <span class="user-mention" data-user-id="352985">@tm</span>. Indeed I'm surprised that there is need to clone <code>Expr</code>s. I need to dive back into the code</p>



<a name="228616913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228616913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228616913">(Mar 03 2021 at 16:01)</a>:</h4>
<p>Dropping <code>ExprKind</code> also looks quite costly. The suggestions about using arena for the purpose would probably help quite a bit.</p>



<a name="228617131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228617131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228617131">(Mar 03 2021 at 16:02)</a>:</h4>
<p>Removing the clones sounds like a good place to start though.</p>



<a name="228617250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228617250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228617250">(Mar 03 2021 at 16:03)</a>:</h4>
<p>Generally, regarding profiling, I mostly run perf locally using CI artifiacts.</p>



<a name="228617534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228617534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228617534">(Mar 03 2021 at 16:04)</a>:</h4>
<p>Do try builds produce artifacts for all targets? I don't have access to a linux machine unfortunately</p>



<a name="228617536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228617536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228617536">(Mar 03 2021 at 16:04)</a>:</h4>
<p>Trying out a custom allocator so that the various  <code>Vec</code>s can also use the arena might be interesting.</p>



<a name="228617556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228617556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228617556">(Mar 03 2021 at 16:04)</a>:</h4>
<p>Just linux unfortunately</p>



<a name="228627391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228627391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228627391">(Mar 03 2021 at 17:00)</a>:</h4>
<p>This line is very suspicious: <a href="https://github.com/rust-lang/rust/blob/7dddea717ab06132820afb1349585d3f5fa5f8d9/compiler/rustc_mir_build/src/build/expr/stmt.rs#L24">https://github.com/rust-lang/rust/blob/7dddea717ab06132820afb1349585d3f5fa5f8d9/compiler/rustc_mir_build/src/build/expr/stmt.rs#L24</a></p>



<a name="228627522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228627522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228627522">(Mar 03 2021 at 17:01)</a>:</h4>
<p>I just removed the <code>Clone</code> implementation for <code>thir::Expr</code> for now</p>



<a name="228627917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228627917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228627917">(Mar 03 2021 at 17:03)</a>:</h4>
<p>Which appart from that line is apparently unused :D</p>



<a name="228628620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228628620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228628620">(Mar 03 2021 at 17:07)</a>:</h4>
<p>It's used in a couple of other places when passing values to <code>mirror</code>,  but I guess those are gone now.</p>



<a name="228628851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228628851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228628851">(Mar 03 2021 at 17:08)</a>:</h4>
<p>Right, I see</p>



<a name="228628859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228628859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228628859">(Mar 03 2021 at 17:08)</a>:</h4>
<p>Pushed a commit</p>



<a name="228628966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228628966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228628966">(Mar 03 2021 at 17:09)</a>:</h4>
<p>Can someone start yet another perf run? Or maybe not now, I don't want to flood the perf queue</p>



<a name="228643801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228643801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228643801">(Mar 03 2021 at 18:37)</a>:</h4>
<p>Wow, actually my "Pull <code>thir::Cx</code> out of the MIR <code>Builder</code>" commit helped a lot with memory consumption, according to the max-rss benchmarks</p>



<a name="228643945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228643945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228643945">(Mar 03 2021 at 18:38)</a>:</h4>
<p>Now we arguably have an improvement over the old approach instead of the expected regression</p>



<a name="228644211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228644211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228644211">(Mar 03 2021 at 18:40)</a>:</h4>
<p>Next on my list is arena allocation, I'll try to work on that tomorrow</p>



<a name="228673546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228673546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228673546">(Mar 03 2021 at 21:41)</a>:</h4>
<p>The instruction counts are already looking better with that <code>clone()</code> removed</p>



<a name="228673784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228673784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228673784">(Mar 03 2021 at 21:42)</a>:</h4>
<p>But max-rss is looking terrible again</p>



<a name="228673821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228673821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228673821">(Mar 03 2021 at 21:42)</a>:</h4>
<p>Do those memory benchmark have a lot of variation?</p>



<a name="228674036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228674036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228674036">(Mar 03 2021 at 21:44)</a>:</h4>
<p>They have a lot, but those benchmarks look like it's a real regression.</p>



<a name="228674253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228674253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228674253">(Mar 03 2021 at 21:46)</a>:</h4>
<p>Right, but <a href="https://perf.rust-lang.org/compare.html?start=939b14334dfec68d85b01b62c1be0172cee03339&amp;end=08d3254f572a6f05bab6fc26045af712e7707394&amp;stat=max-rss">the previous benchmark</a> looked like it was a real improvement, and nothing should have triggered a regression this bad in the last commit. How could removing some <code>#[derive(Clone)]</code>s and a <code>clone()</code> trigger such a regression?</p>



<a name="228680238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228680238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228680238">(Mar 03 2021 at 22:28)</a>:</h4>
<p>A match-stress-enum instruction count regression is in usefulness checking and quite likely unrelated.</p>



<a name="228680396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228680396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228680396">(Mar 03 2021 at 22:29)</a>:</h4>
<p>Usefulness checking does build the THIR for patterns though</p>



<a name="228680696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/228680696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#228680696">(Mar 03 2021 at 22:31)</a>:</h4>
<p>There is just one function that takes 40% of runtime while being very sensitive to optimizer decision.</p>



<a name="229025599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229025599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229025599">(Mar 05 2021 at 21:11)</a>:</h4>
<p>Just pushed a commit with arena allocation</p>



<a name="229025947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229025947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229025947">(Mar 05 2021 at 21:14)</a>:</h4>
<p>Asked for a perf run</p>



<a name="229039476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229039476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229039476">(Mar 05 2021 at 23:06)</a>:</h4>
<p>(I still need to arena-allocate patterns)</p>



<a name="229073673"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229073673" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229073673">(Mar 06 2021 at 07:01)</a>:</h4>
<p>wow, that's already an improvement. Memory does regress a bit on the stress tests, but that's expected for now.</p>



<a name="229106989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229106989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229106989">(Mar 06 2021 at 15:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction/near/229073673">said</a>:</p>
<blockquote>
<p>wow, that's already an improvement. Memory does regress a bit on the stress tests, but that's expected for now.</p>
</blockquote>
<p>So you think we should land it before implementing "build THIR only once for MIR building and exhaustiveness checking"?</p>



<a name="229109566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229109566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229109566">(Mar 06 2021 at 16:17)</a>:</h4>
<p>yes</p>



<a name="229109626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229109626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229109626">(Mar 06 2021 at 16:18)</a>:</h4>
<p>with big things like this, taking the smallest useful step at a time is the best and fastest way to go forward</p>



<a name="229112803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229112803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229112803">(Mar 06 2021 at 17:05)</a>:</h4>
<p>Got it. Let me do some cleanup then.</p>



<a name="229899570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/eager%20THIR%20construction/near/229899570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/eager.20THIR.20construction.html#229899570">(Mar 11 2021 at 18:18)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/82495">#82495</a> is now merged <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>